| Total Complexity | 6 | 
| Total Lines | 61 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; | 
            ||
| 3 | |||
| 4 | @Entity()  | 
            ||
| 5 | export class InvoiceItem { | 
            ||
| 6 |   @PrimaryGeneratedColumn('uuid') | 
            ||
| 7 | private id: string;  | 
            ||
| 8 | |||
| 9 |   @Column({type: 'varchar', nullable: false}) | 
            ||
| 10 | private title: string;  | 
            ||
| 11 | |||
| 12 |   @Column({type: 'integer', nullable: false, comment: 'Stored in minutes'}) | 
            ||
| 13 | private timeSpent: number;  | 
            ||
| 14 | |||
| 15 |   @Column({type: 'integer', nullable: false}) | 
            ||
| 16 | private amount: number;  | 
            ||
| 17 | |||
| 18 |   @Column({type: 'integer', nullable: true, default: 0}) | 
            ||
| 19 | private discount: number;  | 
            ||
| 20 | |||
| 21 | @ManyToOne(  | 
            ||
| 22 | type => Invoice,  | 
            ||
| 23 | invoice => invoice.items,  | 
            ||
| 24 |     {nullable: false, onDelete: 'CASCADE'} | 
            ||
| 25 | )  | 
            ||
| 26 | invoice: Invoice;  | 
            ||
| 27 | |||
| 28 | constructor(  | 
            ||
| 29 | invoice: Invoice,  | 
            ||
| 30 | title: string,  | 
            ||
| 31 | timeSpent: number,  | 
            ||
| 32 | amount: number,  | 
            ||
| 33 | discount?: number  | 
            ||
| 34 |   ) { | 
            ||
| 35 | this.invoice = invoice;  | 
            ||
| 36 | this.title = title;  | 
            ||
| 37 | this.timeSpent = timeSpent;  | 
            ||
| 38 | this.amount = amount;  | 
            ||
| 39 | this.discount = discount;  | 
            ||
| 40 | }  | 
            ||
| 41 | |||
| 42 |   public getId(): string { | 
            ||
| 43 | return this.id;  | 
            ||
| 44 | }  | 
            ||
| 45 | |||
| 46 |   public getTitle(): string { | 
            ||
| 47 | return this.title;  | 
            ||
| 48 | }  | 
            ||
| 49 | |||
| 50 |   public getAmount(): number { | 
            ||
| 51 | return this.amount;  | 
            ||
| 52 | }  | 
            ||
| 53 | |||
| 54 |   public getDiscount(): number { | 
            ||
| 55 | return this.discount;  | 
            ||
| 56 | }  | 
            ||
| 57 | |||
| 58 |   public getTimeSpent(): number { | 
            ||
| 59 | return this.timeSpent;  | 
            ||
| 60 | }  | 
            ||
| 61 | |||
| 62 |   public getInvoice(): Invoice { | 
            ||
| 63 | return this.invoice;  | 
            ||
| 64 | }  | 
            ||
| 66 |